#include <iostream>
#include <vector>
#include <algorithm>

#include "HardDisk.h"
#include "Monitor.h"
#include "Product.h"
#include "SDCard.h"
#include "Software.h"
#include "Stock.h"
#include "USB.h"
#include "ItemsBrowser.h"

using std::sort;
using namespace std;

void main(){
	vector < Product * > productList;
	productList.push_back(new USB("USB07A61", "4GB", "Blue", "Toshiba", 56, 59));
	productList.push_back(new USB("USB02K9Y", "8GB", "Red", "Kingston", 32, 99));
	productList.push_back(new USB("USB061U8", "2GB", "Silver", "Sony", 67, 49));

	productList.push_back(new HardDisk("HD00G7R2", "160GB", false, "Samsung", 24, 349 ));
	productList.push_back(new HardDisk("HD00O184", "250GB", false, "Fujitsu", 38, 429 ));
	productList.push_back(new HardDisk("HD00W37M", "250GB", true, "Hitachi", 47, 479 ));
	productList.push_back(new HardDisk("HD0028HB", "320GB", true, "Hitachi", 22, 559 ));

	productList.push_back(new Monitor("MON0I95A", 17, "BenQ", 13, 1299 ));
	productList.push_back(new Monitor("MON0PKL2", 22, "Samsung", 15, 1999 ));
	productList.push_back(new Monitor("MON07X1C", 19, "Sony", 19, 1699 ));
	productList.push_back(new Monitor("MON0151J", 20, "Samsung", 20, 1839 ));

	productList.push_back(new SDCard("SD00083JK", "4GB", "SD", "Imation", 49, 69 ));
	productList.push_back(new SDCard("SD00URT2", "2GB", "SD", "San Disk", 32, 45 ));
	productList.push_back(new SDCard("SD004VJ9", "1GB", "Micro SD", "San Disk", 22, 29 ));
	productList.push_back(new SDCard("SD00NZ28", "2GB", "Mini SD", "Toshiba", 38, 49 ));

	productList.push_back(new Software("APP06DK1", "PhotoShop", "English", "CS3", "Adobe", 62, 699 ));
	productList.push_back(new Software("APP0KP9T", "MS Office", "English", "2007", "Microsoft", 71, 599 ));
	productList.push_back(new Software("APP0H283", "Premiere", "English", "CS4", "Adobe", 44, 899 ));
	productList.push_back(new Software("APP099A4", "Norton Antivirus", "English", "2009", "Norton", 36, 299));

	sort(productList.begin(), productList.end());

	Stock stock(productList);

	ItemsBrowser itemsBrowser;

	itemsBrowser.displayAllItems(stock,3);
	cout << "\n";

	itemsBrowser.displayATypeOfItems(stock, 1,5);
	cout << "\n";

	itemsBrowser.displayAItems(stock, "APP099A4");
	cout << "\n";

	stock.setBufferItem(5);
	map <int, string> result = stock.getItemsHeader();
	for(int i = 0; i < result.size(); i++){
		cout << result[i];
	}
}